<%@page import="userEntity.User" %>
<%@page import="java.util.List" %>
<%@page import="ticketDao.TicketDao" %>
<%@page import="ticketImplment.TicketImplment" %>
<%@page import="ticketEntity.Ticket" %>
<%@ page contentType="text/html; charset=utf-8" pageEncoding="utf-8" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <link rel="stylesheet" href="bootstrap-3.3.7-dist/css/bootstrap.css">
    <script src="jQuery/jquery-3.3.1.js"></script>
    <script src="bootstrap-3.3.7-dist/js/bootstrap.js"></script>
    <link rel="stylesheet" href="css/my.css">
    <title></title>
    <script type="text/javascript">
        function submit_sure() {
            var gnl = confirm("确定退票！");
            if (gnl === true) {
                return true;
            } else {
                return false;
            }
        }
    </script>
</head>
<body>
<div class="snow">
    <div class="container">
        <!--logo导航开始-->
        <div class="head">
            <a class="ht"><img src="images/logo.jpg"/></a>
            <div class="hs">
            <span><button type="button" class="btn btn-default btn-lg">
                            <a href="#"><span class="glyphicon glyphicon-user"></span></a>
                            </button>
                <button id="hb" class="btn btn-primary btn-lg">${sessionScope.user.getUname()}</button>
            </span>
            </div>
        </div>
        <!--logo导航结束-->
        <!--导航列表开始-->
        <div class="navi-w">
            <div class="navi">
                <ul class="navi">
                    <li>
                        <a href="index.jsp">首页</a>
                    </li>
                    <li>
                        <a href="queryBook.jsp">查询订票</a>
                    </li>
                    <li>
                        <a href="#">出行向导</a>
                    </li>
                    <li class="on">
                        <a href="my.jsp">个人中心</a>
                    </li>
                </ul>
            </div>
        </div>
        <!--导航列表结束-->
        <div id="con" class="container">
            <div class="row">
                <div class="col-sm-4">
                    <ul class="nav nav-pills nav-stacked" style="max-width: 388px;text-align:center;margin-left: -15px;">
                        <li class="active"><a data-toggle="collapse" data-parent="#accordion" href="#collapseOne" style="background-color: #e39e34">我的订单</a>
                            <div id="collapseOne" class="panel-collapse collapse in">
                                <a class="list-group-item" href="myTicket.jsp">订单查询</a>
                                <a class="list-group-item" href="myTicket.jsp">我的车票</a>
                            </div>
                        </li>
                        <li class="active"><a data-toggle="collapse" data-parent="#accordion" href="#collapseTwo" style="background-color: #e39e34">我的个人信息</a>
                            <div id="collapseTwo" class="panel-collapse collapse in">
                                <a class="list-group-item" href="myQuery.jsp">查看个人信息</a>
                                <a class="list-group-item" href="myReset.jsp">修改个人信息</a>
                                <a class="list-group-item" href="myResetPass.jsp">修改密码</a>
                            </div>
                        </li>
                        <li class="active"><a data-toggle="collapse" data-parent="#accordion" href="#collapseThree" style="background-color: #e39e34">常用信息管理</a>
                            <div id="collapseThree" class="panel-collapse collapse in">
                                <a class="list-group-item" href="#">出行向导</a>
                                <a class="list-group-item" href="#">车票快递地址</a>
                            </div>
                        </li>
                        <li class="active"><a data-toggle="collapse" data-parent="#accordion" href="#collapseFour" style="background-color: #e39e34">贴心服务</a>
                            <div id="collapseFour" class="panel-collapse collapse in">
                                <a class="list-group-item" href="#">遗失物品查找</a>
                            </div>
                        </li>
                    </ul>
                </div>
                <div class="col-sm-8">
                    <table align="center" class="table table-bordered" style="margin-left: -58px;border:4px solid #e39e34;">
                        <tr>
                            <th>车票ID</th>
                            <th>姓名</th>
                            <th>证件号</th>
                            <th>路线名</th>
                            <th>始发站</th>
                            <th>出站时间</th>
                            <th>终点站</th>
                            <th>到站时间</th>
                            <th>退票</th>
                        </tr>
                        <%
                            TicketDao ticketImplment = new TicketImplment();
                            List<Ticket> list = null;
                            if (session.getAttribute("user") != null) {
                                list = ticketImplment.QueryTicketUser(((User) session.getAttribute("user")).getUname());
                            }
                            if (list != null) {
                                if (list.size() > 0) {
                                    Ticket ticket;
                                    for (int i = 0; i < list.size(); i++) {
                                        ticket = new Ticket();
                                        ticket = (Ticket) list.get(i);
                        %>
                        <form action="Refund" method="post" onsubmit="return submit_sure()">
                            <input type="hidden" name="RefundTicketId" value="<%=list.get(i).getTid() %>">
                            <tr>
                                <td><%= ticket.getTid() %>
                                </td>
                                <td><%= ticket.getUname() %>
                                </td>
                                <td><%= ticket.getIdCard() %>
                                </td>
                                <td><%= ticket.getRname() %>
                                </td>
                                <td><%= ticket.getFromStation() %>
                                </td>
                                <td><%= ticket.getFromTime() %>
                                </td>
                                <td><%= ticket.getToStation() %>
                                </td>
                                <td><%= ticket.getToTime() %>
                                </td>
                                <td><input type="submit" value="确认" style="background-color: #f0ad4e;border: #f0ad4e;"></td>
                            </tr>
                        </form>
                        <%
                                    }
                                }
                            }
                        %>
                    </table>
                </div>
            </div>
        </div>
        <!--底部-->
        <div class="foot">
            <p>
                <a href="#">关于我们 &nbsp;</a>|
                <a href="#">&nbsp;网站声明 </a>
            </p>
            <p>版权所有©2018 &nbsp; 计科普通一班 &nbsp;第五小组</p>
        </div>
    </div>
</div>
</body>
</html>